﻿<%@ Page Title="ColorPick" Language="C#" %>
<script runat="server">
    string[] colors1 = { "#DDD9C3", "#8DB3E2", "#B8CCE4", "#E5B9B7", "#D7E3BC", "#CCC1D9", "#B7DDE8", "#FBD5B5" };

    string[] colors2 = { "#C4BD97", "#548DD4", "#95B3D7", "#D99694", "#C3D69B", "#B2A2C7", "#92CDDC", "#FAC08F" };

    public string writeColor1()
    {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < colors1.Length; i++)
        {
            sb.AppendFormat("<div class=\"cbox\" style=\"background:{0};\" onclick=\"parent.putColor('{0}');\"></div>", colors1[i]);
        }
        return sb.ToString();
    }

    public string writeColor2()
    {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < colors2.Length; i++)
        {
            sb.AppendFormat("<div class=\"cbox\" style=\"background:{0};\" onclick=\"parent.putColor('{0}');\"></div>", colors2[i]);
        }
        return sb.ToString();
    }

</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <style>
        .cbox {float:left;width:50px;height:50px;margin:5px;}
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div style="padding:10px;width:550px;height:65px;">
        <%= writeColor1() %>
    </div>
    <div style="padding:10px;width:550px;height:65px;">
        <%= writeColor2() %>
    </div>
    </form>
</body>
</html>
